﻿public static class GlobalMembersSkills_kung_fu
{
	// ****************************************************************************
	// * Punch And Kick -- a simple 2D Fighting Game.
	// *
	// * Copyright (C) 2013 by
	// * Liu Chao
	// *
	// * This file is part of the Punch And Kick project, and may only be used,
	// * modified, and distributed under the terms of the GPLv2.
	// *
	// * (GPLv2 is abbreviation of GNU General Public License Version 2)
	// *
	// * By continuing to use, modify, or distribute this file you indicate that you
	// * have read the license and understand and accept it fully.
	// *
	// * The Punch And Kick project is distributed in the hope that it will be
	// * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 
	// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GPL v2 for
	// * more details.
	// *
	// * You should have received a copy of the GPLv2 along with this file. It is
	// * usually in the LICENSE.TXT file, If not, see <http://www.gnu.org/licenses/>.
	// * **************************************************************************

	// ****************************************************************************
	// * Punch And Kick -- 一个普通的2D格斗游戏
	// *
	// * 版权所有 (C) 2013 归属于
	// * 刘超
	// *
	// * 这个文件是 Punch And Kick 项目的一部分，并且只可以根据GPLv2许可协议来使用、
	// * 更改和发布。
	// *
	// * (GPLv2 是 GNU通用公共许可证第二版 的英文缩写)
	// *
	// * 继续使用、修改或发布本文件，表明您已经阅读并完全理解和接受这个许可协议。
	// *
	// * Punch And Kick 项目是基于技术交流目的而加以散布的，但不负任何担保责任，例
	// * 如：稳定性、可玩性、趣味性等的担保，甚至没有适销性或特定用途的隐含担保，详
	// * 情请参照GPLv2许可协议。
	// *
	// * 您应已收到附随于本文件的GPLv2许可协议的副本，它通常在LICENSE.TXT文件中，如果
	// * 没有，请查看：<http://www.gnu.org/licenses/>.
	// * **************************************************************************

	// 功夫家特有技能


	//internal static int AttackDamage_HugJump(GamePlayer_ attacker, GamePlayer_ victim, int victim_state)
	//{
	//	double damage;
	//	damage = victim.property.defense;
	//	damage += (victim.property.max_hp *0.05);
	//	return DamageReduce(victim, victim_state, (int)damage);
	//}

	//internal static int AttackDamage_LiftJump(GamePlayer_ attacker, GamePlayer_ victim, int victim_state)
	//{
	//	double damage;
	//	damage = victim.property.defense;
	//	damage += (victim.property.max_hp *0.05);
	//	damage += attacker.property.throw;
	//	return DamageReduce(victim, victim_state, (int)damage);
	//}

	//internal static LCUI_BOOL CanUseHugJump(GamePlayer_ player)
	//{
	//	GamePlayer_ attacker;
	//	// 该技能不能给非功夫家的角色使用 
	//	if(player.type != (int)GamePlayerType.PLAYER_TYPE_KUNG_FU)
	//	{
	//		return DefineConstantsSkills_kung_fu.FALSE;
	//	}
	//	if (player.control.a_attack == 0)
	//	{
	//		return DefineConstantsSkills_kung_fu.FALSE;
	//	}
	//	attacker = GetTargetInCatchRange(player);
	//	if (attacker != null)
	//	{
	//		player.other = attacker;
	//		return DefineConstantsSkills_kung_fu.TRUE;
	//	}
	//	if(player.state != (int)GamePlayerState.STATE_CATCH || !player.other)
	//	{
	//		return DefineConstantsSkills_kung_fu.FALSE;
	//	}
	//	// 对方需要是被擒住状态 
	//	if(player.other.state != (int)GamePlayerState.STATE_BE_CATCH)
	//	{
	//		return DefineConstantsSkills_kung_fu.FALSE;
	//	}
	//	// 需要是面对面 
	//	if(GamePlayer_IsLeftOriented(player) == GamePlayer_IsLeftOriented(player.other))
	//	{
	//		return DefineConstantsSkills_kung_fu.FALSE;
	//	}
	//	return DefineConstantsSkills_kung_fu.TRUE;
	//}

	////* 在技能结束时 
	//internal static void SelfAtSkillDone(LCUI_Widget_ widget)
	//{
	//	GamePlayer_ player;
	//	player = GameBattle_GetPlayerByWidget(widget);
	//	if(player.other)
	//	{
	//		player.other.other = null;
	//	}
	//	player.other = null;
	//	GamePlayer_UnlockAction(player);
	//	GamePlayer_UnlockMotion(player);
	//	GamePlayer_ResetAttackControl(player);
	//	GamePlayer_SetReady(player);
	//}

	//internal static void TargetAtHugJumpDone(LCUI_Widget_ widget)
	//{
	//	int ret = 0;
	//	GamePlayer_ player;

	//	player = GameBattle_GetPlayerByWidget(widget);
	//	GamePlayer_UnlockAction(player);
	//	ret = GamePlayer_SetLying(player);
	//	GamePlayer_LockAction(player);
	//	GamePlayer_StopXMotion(player);
	//	if(ret == 0)
	//	{
	//		GamePlayer_SetRestTimeOut(player, DefineConstantsSkills_kung_fu.SHORT_REST_TIMEOUT, GamePlayer_StartStand);
	//	}
	//}

	//internal static void TargetStartBounce(LCUI_Widget_ widget)
	//{
	//	double x_speed;
	//	GamePlayer_ player;
	//	player = GameBattle_GetPlayerByWidget(widget);
	//	if (GamePlayer_IsLeftOriented(player) != null)
	//	{
	//		x_speed = DefineConstantsSkills_kung_fu.XSPEED_BOUNCE;
	//	}
	//	else
	//	{
	//		x_speed = -DefineConstantsSkills_kung_fu.XSPEED_BOUNCE;
	//	}
	//	GameObject_SetXSpeed(widget, x_speed);
	//	GameObject_AtLanding(widget, DefineConstantsSkills_kung_fu.ZSPEED_BOUNCE, -DefineConstantsSkills_kung_fu.ZACC_BOUNCE, TargetAtHugJumpDone);
	//}

	//internal static void SelfStartBounce(LCUI_Widget_ widget)
	//{
	//	GamePlayer_ player;
	//	player = GameBattle_GetPlayerByWidget(widget);
	//	GamePlayer_UnlockAction(player);
	//	GamePlayer_ChangeState(player, (int)GamePlayerState.STATE_SQUAT);
	//	GameObject_AtActionDone(widget, (int)ActionType.ACTION_SQUAT, null);
	//	GamePlayer_LockAction(player);
	//	GameObject_AtLanding(widget, DefineConstantsSkills_kung_fu.ZSPEED_BOUNCE, -DefineConstantsSkills_kung_fu.ZACC_BOUNCE, SelfAtSkillDone);
	//	Game_RecordAttack(player, DefineConstantsSkills_kung_fu.ATK_HUG_JUMP, player.other, GamePlayerState.STATE_HALF_LYING);
	//}

	//internal static void ChangeTargetAction(GamePlayer_ player)
	//{
	//	if(!player.other)
	//	{
	//		return;
	//	}
	//	GamePlayer_UnlockAction(player.other);
	//	GamePlayer_ChangeState(player.other, GamePlayerState.STATE_HALF_LYING);
	//	GamePlayer_UnlockAction(player.other);
	//}

	//internal static void GamePlayer_AtHugJumpUpdate(LCUI_Widget_ widget)
	//{
	//	GamePlayer_ player;

	//	player = GameBattle_GetPlayerByWidget(widget);
	//	if(GameObject_GetCurrentActionFrameNumber(player.object_) != 3)
	//	{
	//		return;
	//	}
	//	GameObject_AtLanding(widget, DefineConstantsSkills_kung_fu.ZSPEED_HUG_JUMP, -DefineConstantsSkills_kung_fu.ZACC_HUG_JUMP, SelfStartBounce);
	//	GameObject_AtLanding(player.other.object_, DefineConstantsSkills_kung_fu.ZSPEED_HUG_JUMP, -DefineConstantsSkills_kung_fu.ZACC_HUG_JUMP, TargetStartBounce);
	//	GameObject_AtActionUpdate(player.object_, (int)ActionType.ACTION_CATCH_SKILL_FA, null);
	//}

	//internal static void StartHugJump(GamePlayer_ player)
	//{
	//	double x;
	//	int z_index;

	//	if(!player.other)
	//	{
	//		return;
	//	}
	//	// 发动技能前，停止移动 
	//	GamePlayer_StopXMotion(player);
	//	GamePlayer_StopYMotion(player);
	//	// 对目标进行调整，使技能能够正常实现 
	//	CommonSkill_AdjustTargetAtBeCatch(player);

	//	GamePlayer_UnlockAction(player);
	//	GamePlayer_UnlockAction(player.other);
	//	GamePlayer_ChangeState(player.other, GamePlayerState.STATE_ROLL_DOWN);
	//	GamePlayer_ChangeState(player, (int)GamePlayerState.STATE_CATCH_SKILL_FA);
	//	GamePlayer_LockAction(player);
	//	GamePlayer_LockAction(player.other);
	//	GamePlayer_LockMotion(player.other);

	//	GameObject_AtActionUpdate(player.object_, (int)ActionType.ACTION_CATCH_SKILL_FA, GamePlayer_AtHugJumpUpdate);
	//	GamePlayer_SetActionTimeOut(player, 200, ChangeTargetAction);
	//	// 调整对方的位置 
	//	x = GameObject_GetX(player.object_);
	//	if (GamePlayer_IsLeftOriented(player) != null)
	//	{
	//		x -= 15;
	//	}
	//	else
	//	{
	//		x += 15;
	//	}
	//	GameObject_SetX(player.other.object_, x);
	//	z_index = Widget_GetZIndex(player.object_);
	//	// 被攻击者需要显示在攻击者后面 
	//	Widget_SetZIndex(player.other.object_, z_index-1);
	//	// 重置被攻击的次数 
	//	player.other.n_attack = 0;
	//}

	//internal static LCUI_BOOL CanUseLiftJump(GamePlayer_ player)
	//{
	//	if(player.type != (int)GamePlayerType.PLAYER_TYPE_KUNG_FU)
	//	{
	//		return DefineConstantsSkills_kung_fu.FALSE;
	//	}
	//	if (player.control.a_attack == 0)
	//	{
	//		return DefineConstantsSkills_kung_fu.FALSE;
	//	}
	//	if(player.state != (int)GamePlayerState.STATE_CATCH || !player.other)
	//	{
	//		return DefineConstantsSkills_kung_fu.FALSE;
	//	}
	//	// 对方需要是背面被擒住状态 
	//	if(player.other.state != (int)GamePlayerState.STATE_BACK_BE_CATCH)
	//	{
	//		return DefineConstantsSkills_kung_fu.FALSE;
	//	}
	//	// 需要是面朝同一方向 
	//	if(GamePlayer_IsLeftOriented(player) != GamePlayer_IsLeftOriented(player.other))
	//	{
	//			return DefineConstantsSkills_kung_fu.FALSE;
	//	}
	//	return DefineConstantsSkills_kung_fu.TRUE;
	//}

	//internal static void ChangeSelfActionToLiftFall(GamePlayer_ player)
	//{
	//	GamePlayer_UnlockAction(player);
	//	GamePlayer_ChangeState(player, (int)GamePlayerState.STATE_LIFT_FALL);
	//	GamePlayer_LockAction(player);
	//}

	////* 在技能结束时 
	//internal static void SelfAtLiftJumpDone(LCUI_Widget_ widget)
	//{
	//	GamePlayer_ player;

	//	player = GameBattle_GetPlayerByWidget(widget);
	//	GamePlayer_SetActionTimeOut(player, 100, GamePlayer_StartStand);
	//	if(player.other)
	//	{
	//		Game_RecordAttack(player, DefineConstantsSkills_kung_fu.ATK_LIFT_JUMP, player.other, GamePlayerState.STATE_LYING);
	//		GamePlayer_SetHit(player.other);
	//	}
	//}

	////* 在技能发动者达到最高处时降落 
	//internal static void SelfStartFall(LCUI_Widget_ widget)
	//{
	//	double z;
	//	int z_index;
	//	int h1;
	//	int h2;
	//	GamePlayer_ player;

	//	player = GameBattle_GetPlayerByWidget(widget);
	//	if(!player.other)
	//	{
	//		GamePlayer_SetFall(player);
	//	}
	//	GamePlayer_UnlockAction(player);
	//	GamePlayer_ChangeState(player, (int)GamePlayerState.STATE_HALF_LYING);
	//	GamePlayer_LockAction(player);
	//	h1 = GameObject_GetFrameTop(player.object_, (int)ActionType.ACTION_LIFT_JUMP, 0);
	//	h2 = GameObject_GetFrameTop(player.other.object_, (int)ActionType.ACTION_LYING, 0);
	//	z = GameObject_GetZ(player.object_);
	//	GameObject_SetZ(player.object_, z+h1/2);
	//	GameObject_SetZ(player.other.object_, z+h1/2-h2);
	//	z_index = Widget_GetZIndex(player.object_);
	//	// 被攻击者需要显示在攻击者后面 
	//	Widget_SetZIndex(player.other.object_, z_index-1);
	//	GameObject_AtZeroZSpeed(player.object_, null);
	//	GameObject_AtLanding(player.object_, -DefineConstantsSkills_kung_fu.ZSPEED_JUMP, -5 *DefineConstantsSkills_kung_fu.ZACC_JUMP, SelfAtLiftJumpDone);
	//	GameObject_AtLanding(player.other.object_, -DefineConstantsSkills_kung_fu.ZSPEED_JUMP, -5 *DefineConstantsSkills_kung_fu.ZACC_JUMP, null);
	//}

	//// 开始发动技能 
	//internal static void StartLiftJump(GamePlayer_ player)
	//{
	//	double x;
	//	double y;
	//	double z;
	//	// 发动技能前，停止移动 
	//	GamePlayer_StopXMotion(player);
	//	GamePlayer_StopYMotion(player);

	//	GamePlayer_UnlockAction(player.other);
	//	GamePlayer_UnlockAction(player);
	//	GamePlayer_ChangeState(player.other, GamePlayerState.STATE_LYING);
	//	GamePlayer_ChangeState(player, (int)GamePlayerState.STATE_LIFT_JUMP);
	//	GamePlayer_LockAction(player.other);
	//	GamePlayer_LockAction(player);

	//	GamePlayer_SetRestTimeOut(player.other, DefineConstantsSkills_kung_fu.SHORT_REST_TIMEOUT, GamePlayer_StartStand);
	//	x = GameObject_GetX(player.object_);
	//	y = GameObject_GetY(player.object_);
	//	z = GameObject_GetZ(player.object_);
	//	z += GameObject_GetFrameTop(player.object_, (int)ActionType.ACTION_LIFT_JUMP, 0);
	//	GameObject_SetX(player.other.object_, x);
	//	GameObject_SetY(player.other.object_, y);
	//	GameObject_SetZ(player.other.object_, z);
	//	GameObject_AtLanding(player.object_, DefineConstantsSkills_kung_fu.ZSPEED_JUMP, -DefineConstantsSkills_kung_fu.ZACC_JUMP, null);
	//	GameObject_AtLanding(player.other.object_, DefineConstantsSkills_kung_fu.ZSPEED_JUMP, -DefineConstantsSkills_kung_fu.ZACC_JUMP, null);
	//	GamePlayer_SetActionTimeOut(player, 100, ChangeSelfActionToLiftFall);
	//	GameObject_AtZeroZSpeed(player.object_, SelfStartFall);
	//}

	////* 注册功夫家特有的技能 
	//public static void KungFuSkill_Register()
	//{
	//	SkillLibrary_AddSkill(DefineConstantsSkills_kung_fu.SKILLNAME_HUG_JUMP, BattleState.SKILLPRIORITY_MACH_A_ATTACK, CanUseHugJump, StartHugJump);
	//	SkillLibrary_AddSkill(DefineConstantsSkills_kung_fu.SKILLNAME_LIFT_JUMP, BattleState.SKILLPRIORITY_MACH_A_ATTACK, CanUseLiftJump, StartLiftJump);
	//	AttackLibrary_AddAttack(DefineConstantsSkills_kung_fu.ATK_HUG_JUMP, AttackDamage_HugJump, null);
	//	AttackLibrary_AddAttack(DefineConstantsSkills_kung_fu.ATK_LIFT_JUMP, AttackDamage_LiftJump, null);
	//}
}
